package com.kaluli.system.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

public class UserInterceptor extends HandlerInterceptorAdapter {
//	
//	@Autowired
//	private UserService userService;

	@Override
	public boolean preHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler) throws Exception {
		HttpSession session = request.getSession();
//		User user = (User) session.getAttribute(UserContext.USER_SESSION_KEY);
//		
//		if( user == null) {
//			String username = SecurityContextHolder.getContext().getAuthentication().getName();
//			user = userService.findByName(username);
//			System.out.println(username);
//			session.setAttribute(UserContext.USER_SESSION_KEY, user);
//		}
//		
		return super.preHandle(request, response, handler);
	}

}
